home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / xceedzip / xceedzip.exe / Samples / Zip Manager / Vb6 / frmOptionsColumns.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-04-27  |  8.5 KB  |  211 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmOptionsColumns 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Column settings"
  6.    ClientHeight    =   4755
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   5790
  10.    ControlBox      =   0   'False
  11.    Icon            =   "frmOptionsColumns.frx":0000
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   4755
  16.    ScaleWidth      =   5790
  17.    ShowInTaskbar   =   0   'False
  18.    StartUpPosition =   1  'CenterOwner
  19.    Begin MSComctlLib.ListView lstColCfg 
  20.       Height          =   3615
  21.       Left            =   240
  22.       TabIndex        =   0
  23.       Top             =   360
  24.       Width           =   5295
  25.       _ExtentX        =   9340
  26.       _ExtentY        =   6376
  27.       View            =   3
  28.       LabelEdit       =   1
  29.       MultiSelect     =   -1  'True
  30.       LabelWrap       =   -1  'True
  31.       HideSelection   =   0   'False
  32.       Checkboxes      =   -1  'True
  33.       FullRowSelect   =   -1  'True
  34.       _Version        =   393217
  35.       ForeColor       =   -2147483640
  36.       BackColor       =   -2147483643
  37.       BorderStyle     =   1
  38.       Appearance      =   1
  39.       NumItems        =   2
  40.       BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  41.          Text            =   "Name"
  42.          Object.Width           =   2822
  43.       EndProperty
  44.       BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  45.          SubItemIndex    =   1
  46.          Text            =   "Description"
  47.          Object.Width           =   6350
  48.       EndProperty
  49.    End
  50.    Begin VB.Frame frmColConfig 
  51.       Caption         =   "Select the columns to display in the main file list box:"
  52.       BeginProperty Font 
  53.          Name            =   "MS Sans Serif"
  54.          Size            =   8.25
  55.          Charset         =   0
  56.          Weight          =   700
  57.          Underline       =   0   'False
  58.          Italic          =   0   'False
  59.          Strikethrough   =   0   'False
  60.       EndProperty
  61.       Height          =   3975
  62.       Left            =   120
  63.       TabIndex        =   3
  64.       Top             =   120
  65.       Width           =   5535
  66.    End
  67.    Begin VB.CommandButton CmdSettingsCancel 
  68.       Cancel          =   -1  'True
  69.       Caption         =   "&Cancel"
  70.       Height          =   375
  71.       Left            =   4440
  72.       TabIndex        =   2
  73.       Top             =   4265
  74.       Width           =   1215
  75.    End
  76.    Begin VB.CommandButton cmdSettingsOk 
  77.       Caption         =   "&OK"
  78.       Height          =   375
  79.       Left            =   3120
  80.       TabIndex        =   1
  81.       Top             =   4265
  82.       Width           =   1215
  83.    End
  84. Attribute VB_Name = "frmOptionsColumns"
  85. Attribute VB_GlobalNameSpace = False
  86. Attribute VB_Creatable = False
  87. Attribute VB_PredeclaredId = True
  88. Attribute VB_Exposed = False
  89. Option Explicit
  90. '=============================================================================
  91. ' Description: The frmSettingsColumns form gives the user the opportunity to
  92. '              customize which file info columns appear in the main window.
  93. '=============================================================================
  94. 'Two arrays representing the items checkboxes
  95. Dim bColvisible(1 To 12) As Boolean
  96. Dim userChoices(1 To 12) As Boolean
  97. 'Usual counter
  98. Dim counter As Integer
  99. '------------------------------------------------------------------------------------
  100. 'Checks and unchecks the boxes according to the main window's settings.
  101. '------------------------------------------------------------------------------------
  102. Private Sub CheckOrUncheck(xZip As XceedZip)
  103.     For counter = 1 To 12 Step 1
  104.         If bColvisible(counter) Then
  105.             lstColCfg.ListItems.Item(counter).Checked = True
  106.         Else
  107.             lstColCfg.ListItems.Item(counter).Checked = False
  108.         End If
  109.     Next counter
  110. End Sub
  111. '------------------------------------------------------------------------------------
  112. 'Creates the columns on the form
  113. '------------------------------------------------------------------------------------
  114. Private Sub CreateCol(xZip As XceedZip)
  115.     For counter = 1 To 12 Step 1
  116.        If frmMain.lstMain.ColumnHeaders.Item(counter).Width = 0 Then
  117.             bColvisible(counter) = False
  118.             If frmMain.lstMain.ColumnHeaders.Item(counter).Tag = "" Then
  119.                 frmMain.lstMain.ColumnHeaders.Item(counter).Tag = "1500"
  120.             End If
  121.        Else
  122.             bColvisible(counter) = True
  123.             frmMain.lstMain.ColumnHeaders.Item(counter).Tag = Str(frmMain.lstMain.ColumnHeaders.Item(counter).Width)
  124.        End If
  125.     Next counter
  126. End Sub
  127. '------------------------------------------------------------------------------------
  128. ' Loads the items in the listbox
  129. '------------------------------------------------------------------------------------
  130. Private Sub LoadListItems(xZip As XceedZip)
  131.     Dim setting As ListItem
  132.     Set setting = lstColCfg.ListItems.Add(, , "Name")
  133.          setting.SubItems(1) = "The File Name"
  134.        
  135.     Set setting = lstColCfg.ListItems.Add(, , "Comment")
  136.          setting.SubItems(1) = "Comment Inserted with file"
  137.          
  138.     Set setting = lstColCfg.ListItems.Add(, , "Size")
  139.          setting.SubItems(1) = "Size of file"
  140.          
  141.     Set setting = lstColCfg.ListItems.Add(, , "Packed")
  142.          setting.SubItems(1) = "Size of file in the zip file"
  143.          
  144.     Set setting = lstColCfg.ListItems.Add(, , "Attributes")
  145.          setting.SubItems(1) = "File Attributes"
  146.        
  147.     Set setting = lstColCfg.ListItems.Add(, , "CRC")
  148.          setting.SubItems(1) = "Value used to verify integrity of file"
  149.        
  150.     Set setting = lstColCfg.ListItems.Add(, , "Last Modified")
  151.          setting.SubItems(1) = "Date the file was last modified"
  152.     Set setting = lstColCfg.ListItems.Add(, , "Last Accessed")
  153.          setting.SubItems(1) = "Date the file was last accessed"
  154.          
  155.     Set setting = lstColCfg.ListItems.Add(, , "Created")
  156.          setting.SubItems(1) = "Date the file was created"
  157.          
  158.     Set setting = lstColCfg.ListItems.Add(, , "Path")
  159.          setting.SubItems(1) = "Stored Path Name"
  160.          
  161.     Set setting = lstColCfg.ListItems.Add(, , "Method")
  162.          setting.SubItems(1) = "Compression Method"
  163.     Set setting = lstColCfg.ListItems.Add(, , "Encrypted")
  164.          setting.SubItems(1) = "Checks if file is encrypted"
  165. End Sub
  166. '------------------------------------------------------------------------------------
  167. ' Shows the FrmSettingsColumns form to the user
  168. '------------------------------------------------------------------------------------
  169. Public Function ShowForm(xZip As XceedZip) As Boolean
  170.     Tag = "0"
  171.     'Creates the columns on the form
  172.     Call CreateCol(xZip)
  173.     'Loads the main window's columns properties in the list
  174.     Call LoadListItems(xZip)
  175.     'Checks or unchecks the boxes according to the column properties
  176.     Call CheckOrUncheck(xZip)
  177.     ' Shows the window
  178.     Show vbModal
  179.     ' If tag = "1" then the user clicked on ADD and the form's controls
  180.     ' values are copied in the xZip properties
  181.     If Tag = "1" Then
  182.         Call UpdateColSettings(xZip)
  183.     End If
  184.     ShowForm = (frmOptionsColumns.Tag = "1")
  185. End Function
  186. '------------------------------------------------------------------------------------
  187. ' Update the columns on the main window
  188. '------------------------------------------------------------------------------------
  189. Private Sub UpdateColSettings(xZip As XceedZip)
  190.     For counter = 1 To 12 Step 1
  191.        If lstColCfg.ListItems.Item(counter).Checked Then
  192.             frmMain.lstMain.ColumnHeaders.Item(counter).Width = Val(frmMain.lstMain.ColumnHeaders.Item(counter).Tag)
  193.        Else
  194.             frmMain.lstMain.ColumnHeaders.Item(counter).Width = 0
  195.        End If
  196.     Next counter
  197. End Sub
  198. '------------------------------------------------------------------------------------
  199. ' If OK is clicked, tag takes the "1" value
  200. '------------------------------------------------------------------------------------
  201. Private Sub cmdSettingsOk_Click()
  202.     Tag = "1"
  203.     Hide
  204. End Sub
  205. '------------------------------------------------------------------------------------
  206. ' If cancel is pressed, tag stays at "0"
  207. '------------------------------------------------------------------------------------
  208. Private Sub CmdSettingsCancel_Click()
  209.     Hide
  210. End Sub
  211.